package com.lxh.chainofresponsibility;

/**
 * 责任链模式
 * Create by lxh on 2020/2/15
 */
public class Main {
    public static void main(String[] args) {
        // 经理
        CommonManager commonManager = new CommonManager();
        // 总监
        Majordomo majordomo = new Majordomo();
        // 总经理
        GeneralManager generalManager = new GeneralManager();
        // 设置上级
        commonManager.setSuperior(majordomo);
        majordomo.setSuperior(generalManager);

        Request request = new Request(2);
        commonManager.request(request);

        Request request1 = new Request(8);
        commonManager.request(request1);

        Request request2 = new Request(13);
        commonManager.request(request2);

        Request request3 = new Request(20);
        commonManager.request(request3);
    }
}
